package com.feng.api;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "OrderController", tags = "Order API测试接口")
@RestController
public class OrderController {

    @ApiOperation("order info")
    @GetMapping("/order/info")
    @HystrixCommand(fallbackMethod = "defaultCallHello")
    public String orderInfo() {
        return "orderinfo";
    }


    public String defaultCallHello() {
        return "order info fail";
    }


//    protected void addSingletonFactory(String beanName, ObjectFactory<?> singletonFactory) {
//        Assert.notNull(singletonFactory, "Singleton factory must not be null");
//    }
//
//    public void test(){
//        addSingletonFactory("",() -> new Object());
//    }

}